#!/bin/bash
set -e
set -x
MYDIR="${0%/*}"
cd "$MYDIR/.."
source "recipes/common.sh"


# RECIPE START lz4
# Note: this builds only command line tools, NOT the libraries

rm -rf build/lz4
cp -a lz4 build/
cd build/lz4
# Thanks God lz4 does NOT use autocrap
make -j${JOBS} -C programs \
	CC="${TARGET}-gcc" \
	AR="${TARGET}-ar" \
	all

mkdir -p "${stage}${prefix}/bin"
cp -a --target-directory=${stage}${prefix}/bin programs/lz4
for tool in lz4c lz4cat unlz4; do
	ln -sf lz4 "${stage}${prefix}/bin/$tool"
done
cd ../..
rm -rf build/lz4

# RECIPE END lz4
